package icu.nil.demo.shell.service

import org.springframework.web.socket.WebSocketSession

import java.io.IOException

/**
 * Create by xiangliyou on 2020/3/10 16:56.
 * email: xiangliyou@aliyun.com
 * Des: WebSSH 的处理逻辑
 */
interface WebSSHService {

    /**
     * 初始化ssh连接
     */
    fun initConnection(session: WebSocketSession)

    /**
     *  处理客户段发的数据
     */
    fun recvHandle(buffer: String, session: WebSocketSession)

    /**
     * 数据写回前端 for websocket
     */
    @Throws(IOException::class)
    fun sendMessage(session: WebSocketSession, buffer: ByteArray)

    /**
     * 关闭连接
     */
    fun close(session: WebSocketSession)

}